﻿using Majoopic.DataAccess.Model;
using Majoopic.DataAccess.Service;

namespace Majoopic.DataAccess.SQL
{
    /// <summary>
    /// Manage the picture to the SQL database
    /// </summary>
    public class PictureSQLAccess : AbstractSQLService, IPictureAccess
    {
        #region Constructor
        /// <summary>
        /// Constructor
        /// </summary>
        public PictureSQLAccess()
        {

        }
        #endregion

        #region IPictureAccess Methods
        /// <summary>
        /// Save a picture with all the dependance in the database
        /// </summary>
        /// <param name="picture">Picture to save</param>
        public void SavePicture(Picture picture)
        {
            using (MajoopicEntities dbContext = new MajoopicEntities())
            {
                dbContext.Pictures.Add(picture);
                dbContext.SaveChanges();
            }
        }
        #endregion
    }
}
